<?php defined('SYSPATH') or die();?>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    {template 'stourtravel/public/public_min_js'}
    {php echo Common::getCss('base.css,order.css,jqtransform.css'); }
    {php echo Common::getScript('jquery.jqtransform.js,hdate/hdate.js');}
    {php echo Common::getCss('hdate.css','js/hdate'); }

    <script language="javascript">

    </script>
</head>

<body style="background-color: #fff">
<div class="derive_box">
    <div class="derive_con">
        <form>
            <table class="derive_tb">
                <tr>
                    <td></td>
                    <td><span><label>自定义时间段：</label></span></td>
                    <td  colspan="2">
                        <input type="text" value="" id="starttime" class="time_box" onclick="calendar.show({ id: this })" />
                        <span class="derive_arrow_rig"></span>
                        <input type="text" id="endtime" class="time_box" onclick="calendar.show({ id: this })" />
                    </td>
                </tr>
            </table>
            时间段不能超过一个月（31天）
            <div class="now_derive_box"><a class="derive_btn btn_excel" href="javascript:;">立即导出</a></div>
        </form>
    </div>
</div>
</body>
<script>
    $(function(){
        $(".btn_excel").click(function () {
            var starttime = 0;
            var endtime = 0;
            starttime = $('#starttime').val();
            endtime = $("#endtime").val();

            var Time1 = new Date(starttime);
            var timestemp1 = Time1.getTime();

            var Time2 = new Date(endtime);
            var timestemp2 = Time2.getTime();

            if (starttime == '' || endtime == '') {
                ST.Util.showMsg('请选择时间段', 5, 1000);
                return false;
            }
            if (timestemp2<timestemp1) {
                ST.Util.showMsg('结束时间应大于开始时间', 5, 1000);
                return false;
            }
            if ((timestemp2-timestemp1)/1000/60/60/24 > 31) {
                ST.Util.showMsg('时间段不能超过一个月（31天）', 5, 1000);
                return false;
            }
            var url = SITEURL + 'member/export_excel?starttime=' + starttime + '&endtime=' + endtime ;
            window.open(url);
       })
    });
</script>
</html>